home *** CD-ROM | disk | FTP | other *** search
-
- Files in this archive:
- RealStr.Doc - This file
- RealStr.Pas - Unit containing the RealToString () function
- Test. Pas - RealToString example - type 0 or letter to exit
-
-
- RealToString formats a floating point double, real, or single number
- into a string, according to the requested number of significant digits.
-
-
- The number is displayed without the use of scientific notation, if
- it is possible to do so and still display the requested number of significant
- digits. Also the number is rounded at the number of significant digits + 1
- and all trailing zeros are removed.
-
-
- Because many numbers represented in a base 2 floating point format
- do not have an exact equivalent in base 10, any rounding done to a base 2
- number, which is then converted by Str() to a base 10 string, will be
- ineffective. To bypass this problem, RealStr uses Str to convert the
- floating point number to a base 10 string and then rounds and formats the
- string.
-
-
- Test.exe gives an example of how the routine is used and what the
- results look like for different significant digits. Also, running Test.exe
- for several numbers will give the user an idea of why the TP reference guide
- says the significant digits of a single type are 7 TO 8, a real type 11 TO 12,
- and a double type 15 TO 16.
-
-
- Example of using RealToString vs. Str :
-
- var
- TempStr : string;
- Number : real;
-
- begin
- Number := 5.1;
- Str (Number, TempStr); { TempStr = '5.09999...E 0000' }
- { 5.1 cannot be represented exactly }
- { as a single or real type number }
- Number := 0.01;
- Str (Number, TempStr); { TempStr = '1.00000...E-0002' }
- end;
-
-
- begin
- Number := 5.1;
- TempStr := RealToString (11, Number); { TempStr = '5.1' }
-
- Number := 0.01;
- TempStr := RealToString (11, Number); { TempStr = '0.01' }
- end;
-
-
-
- This routine is released to public domain by the author on 7/5/90.
-
- If you find any bugs in the routine, please drop me a note by
- Compuserve EMAIL. Thanks.
-
-
- Rich Mullen 76566,1325
-
-
-
- ----------------end-of-author's-documentation---------------
-
- Software Library Information:
-
- This disk copy provided as a service of
-
- The Public (Software) Library
-
- We are not the authors of this program, nor are we associated
- with the author in any way other than as a distributor of the
- program in accordance with the author's terms of distribution.
-
- Please direct shareware payments and specific questions about
- this program to the author of the program, whose name appears
- elsewhere in this documentation. If you have trouble getting
- in touch with the author, we will do whatever we can to help
- you with your questions. All programs have been tested and do
- run. To report problems, please use the form that is in the
- file PROBLEM.DOC on many of our disks or in other written for-
- mat with screen printouts, if possible. The P(s)L cannot de-
- bug programs over the telephone.
-
- Disks in the P(s)L are updated monthly, so if you did not get
- this disk directly from the P(s)L, you should be aware that
- the files in this set may no longer be the current versions.
-
- For a copy of the latest monthly software library newsletter
- and a list of the 2,000+ disks in the library, call or write
-
- The Public (Software) Library
- P.O.Box 35705
- Houston, TX 77235-5705
- (713) 524-6394
-